var mongoose = require("mongoose")
var Schema = mongoose.Schema

mongoose.connect("mongodb://localhost/test", { useMongoClient: true })

var UserSchema = new Schema({
  email: {
    type: String,
    required: true
  },
  nickname: {
    type: String,
    required: true
  },
  password: {
    type: String,
    required: true
  },
  create_time: {
    type: Date,
    default: Date.now
  },
  last_modify_time: {
    type: Date,
    default: Date.now
  },
  avater: {
    type: String,
    default: '/public/img/avatar-default.png'
  },
  bio: {
    type: String,
    default: ''
  },
  gender: {
    type: Number,
    enum: [-1, 0, 1],
    default: -1
  },
  birthday: {
    type: Date
  },
  status: {
    type: Number,
    // 0. 没有权限控制
    // 1. 不能评论
    // 2. 不能登录
    enum: [0, 1, 2],
    default: 0
  }

})


module.exports = mongoose.model("User", UserSchema)

